package com.gateway.plugin.api;

import org.springframework.web.server.ServerWebExchange;

import java.net.InetSocketAddress;

/**
 * @program: ahcloud-gateway
 * @description:
 * @author: YuKai Fan
 * @create: 2024/6/7 16:40
 **/
public interface RemoteAddressResolver {

    /**
     * 解析网络地址
     *
     * @param exchange
     * @return
     */
    default InetSocketAddress resolve(ServerWebExchange exchange) {
        return exchange.getRequest().getRemoteAddress();
    }
}
